import java.util.*;

public class PrimeNumbers
{
    public static void main (String[] args)
    {
        Scanner in = new Scanner(System.in);
        System.out.println("Enter any mumber:");
        int number = in.nextInt();
        List<Integer> primeNumb = new ArrayList<Integer>();
        for (int i=2; i<=number; i++)
        {
            if (i == 2)
                primeNumb.add(i);
            for (int j=2; j<i; j++)
            {
                if (i%j == 0)
                    break;
                if (j == i-1)
                    primeNumb.add(i);
            }
        }
        System.out.println("prime numbers are:" + primeNumb.toString());
    }
}
